package com.fy.fyzf.weight;

import android.content.Context;
import android.view.Gravity;
import android.view.View;
import android.widget.TextView;

import com.fy.fyzf.R;
import com.fy.fyzf.dialog.BaseDialog;
import com.fy.fyzf.dialog.FlowPopWindow;

public class CommonDialog extends BaseDialog {

    private TextView tvContent;
    private TextView tvTitle;

    public CommonDialog(Context mContext) {
        super(mContext, R.layout.dialog_common, Gravity.CENTER, false);
        init();
    }

    private String content;
    private String title;
    public void setContent(String s){
        content = s;
        tvContent.setText(content);
    }

    public void setTitle(String s){
        title = s;
        tvTitle.setText(title);
    }
    public TextView getTextView() {
        return tvContent;
    }

    private void init() {
        TextView tvCancel = getView(R.id.tv_cancel);
        TextView tvSure = getView(R.id.tv_sure);
        tvTitle = getView(R.id.tv_title);
        tvContent = getView(R.id.tv_content);
        tvCancel.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                toggleDialog();
            }
        });

        tvSure.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (listener != null) {
                    listener.onClick();
                }
            }
        });
    }

    private OnConfirmClickListener listener;
    public void setOnconirmListener(OnConfirmClickListener onPayListener){
        listener = onPayListener;
    }
    public interface OnConfirmClickListener {
        void onClick();
    }
}
